package edu.zut.main.thread;

import java.util.ArrayList;
import java.util.List;

public class ThreadList {

    public static void main(String[] args) {

        List<String> list = new ArrayList<>();
        //多线程之下list是不安全的
        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                list.add(Thread.currentThread().getName());
            }).start();
        }
        System.out.println(list.size());
    }

}
